package demo;
class Animal1{
    String name;
    int age;
    public Animal1(String name,int age){
        this.name = name;
        this.age = age;
    }
    public void eat(){
        System.out.println(name+"正在吃饭！");
    }
}
class Dog1 extends Animal1{
    public Dog1(String name,int age){
        super(name,age);
    }
    @Override
    public void eat(){
        System.out.println(name+"正在吃饭！");
    }
}
class Cat1 extends Animal1{
    public Cat1(String name,int age){
        super(name,age);
    }
    @Override
    public void eat(){
        System.out.println(name+"正在吃饭!");
    }
}

public class Test2 {
    public static void eat(Animal1 a){
        a.eat();
    }
    public static void main(String[] args) {
        Dog1 dog = new Dog1("旺财",10);
        Cat1 cat = new Cat1("花花",10);
        eat(dog);
        eat(cat);
    }
}
